package com.easy.frame.servers.sys.service.impl.type;

import com.easy.frame.base.basic.pojo.vo.BaseTreeVO;
import com.easy.frame.servers.sys.dto.SysCategoryTypeDTO;
import com.easy.frame.servers.sys.entity.SysCategoryType;
import com.easy.frame.servers.sys.service.type.SysCategoryTypeService;
import com.easy.frame.servers.sys.service.type.SysMaterielTypeService;
import com.easy.frame.servers.sys.vo.SysCategoryTypeVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * 物料分类表 服务实现类
 *
 * @author tp
 * @since 2021-1-4
 */
@Slf4j
@Service
public class SysMaterielTypeServiceImpl implements SysMaterielTypeService {

    @Resource
    SysCategoryTypeService sysCategoryTypeService;

    @Override
    public BaseTreeVO getEquTypeTree(int enabled, String equName, String type) {
        return sysCategoryTypeService.getEquTypeTree(enabled, equName, type);
    }

    /**
     * 点击添加返回给前端的封装数据
     */
    @Override
    public SysCategoryTypeVO clickAddLoa(Integer parentLoId, String type) {
        return sysCategoryTypeService.clickAddEqu(parentLoId, type);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public SysCategoryType add(SysCategoryTypeDTO addDTO) {
        return sysCategoryTypeService.add(addDTO);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public SysCategoryType modify(SysCategoryTypeDTO entity) {
        return sysCategoryTypeService.modify(entity);
    }

    @Override
    public int countById(Long id) {
        return sysCategoryTypeService.countById(id);
    }

    @Override
    public void updateDelete(Long id) {
        sysCategoryTypeService.updateDelete(id);
    }

    @Override
    public void updateParentDelete(Long id) {
        sysCategoryTypeService.updateParentDelete(id);
    }
}
